package com.wss.lsl.alading.service;

import com.wss.lsl.alading.domain.Unit;
import com.wss.lsl.alading.mapper.UnitMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UnitService implements IUnitService {
	
	private Logger logger = LoggerFactory.getLogger(this.getClass());
	
	@Autowired
	private UnitMapper unitMapper;
	
	@Override
	public Unit findUnit() {
		
		return unitMapper.selectUnit();
	}

	@Override
	public Integer createOrUpdateUnit(Unit unit) {
		if(null == unit.getPointId()){
			return unitMapper.insert(unit);
		}
		return unitMapper.update(unit);
	}

}
